function saveName(elemId) {
	var elemValue=document.getElementById(elemId).value;
	if(elemId==null||elemId==""){
		alert("用户明不能为空");
		return;
	}
	var time = new Date().getTime();
    $.ajax ({
        url: base + "/user/config/index!name?time=" + time,
        data:  {
    				"name":elemValue
        		},
        async: false,
        type:'POST',
        success: function(resp){
        	alert("保存成功");
        	document.getElementById(elemId+"_show").innerHTML=elemValue;
        }
    });
}

function savePassword(){
	if(!checkPasswrod()){
		return;
	}
	var time = new Date().getTime();
	//验证员密码是否正确
	 $.ajax ({
	        url: base + "/user/config/index!checkPassword?time=" + time,
	        data:  {
	    				"oldPassword":document.getElementById("oldPassword").value
	        		},
	        async: false,
	        type:'POST',
	        success: function(resp){
	        	if(resp!="true"){
	        		alert("原密码不正确");
	        		return;
	        	}
	        	//保存密码
	        	 $.ajax ({
	        	        url: base + "/user/config/index!password?time=" + time,
	        	        data:  {
	        	    				"password":document.getElementById("password").value
	        	        		},
	        	        async: false,
	        	        type:'POST',
	        	        success: function(resp){
	        	        	alert("保存成功");
	        	        	document.getElementById("oldPassword").value=document.getElementById("password").value;
	        	        }
	        	    });
	        	
	        }
	    });
}

function checkPasswrod(){
	var oldpassword=document.getElementById("oldPassword").value;
	var password=document.getElementById("password").value;
	var confirmPassword=document.getElementById("confirmPassword").value;
	if(oldpassword==null||oldpassword==""){
		alert("原密码不能为空");
		return false;
	}
	if(password==null||password==""){
		alert("密码不能为空");
		return false;
	}
	if(confirmPassword==null||confirmPassword==""){
		alert("确认密码不能为空");
		return false;
	}
	if(password!=confirmPassword){
		alert("两次密码输入不一致");
		return false;
	}
	return true;
}